package com.example.admin19.myandfixtext;

import android.app.Application;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.util.Log;

import com.alipay.euler.andfix.patch.PatchManager;

import cn.jpush.android.api.JPushInterface;

/**
 * Created by admin19 on 2016/12/14.
 */

public class BaseApplication extends Application {
        private static  final String TAG="AndFix";
    public static String VERSION_NAME="";
    public static PatchManager mPatchManeger;

    @Override
    public void onCreate() {
        super.onCreate();
        try {
            PackageInfo packageItemInfo=this.getPackageManager()
                    .getPackageInfo(this.getPackageName(),0);
            VERSION_NAME=packageItemInfo.versionName;


        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        JPushInterface.init(this);
        initAndFix();


    }

    private void initAndFix() {
        mPatchManeger=new PatchManager(this);
        mPatchManeger.init(VERSION_NAME);
        Log.d("TAG","inited.");
        mPatchManeger.loadPatch();
    }
}
